<?php


namespace App\Admin\Handers;

use App\Models\Room;

class WeChatHander
{
	
	// 获取门店房间二维码
	public function getPromoCodeUrl($user_id)
	{
		$data = [
			'user_id' => $user_id,
		];
		$data = json_encode($data);
		$url = "http://dev-ktvnewproapi.ffun360.com/wechat/small_program_code".
			"?json=pages/index/index?data=".$data;
		
		$res = $this->httpGet($url);
		if(!empty($res)) {
			return $res;
		} else {
			return false;
		}
	}

	public function httpGet($url)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 500);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_URL, $url);
        $res = curl_exec($curl);
        curl_close($curl);
        return $res;
    }
}